package com.wolfstreet.wsonline.util;

import java.util.Vector;

import android.content.Context;
import android.content.Intent;

/**
 * @author sy
 * 
 */
public class ActivityUtil {

	/**
	 * 页面跳转
	 */
	public static void startActivity(Context context, Class<?> cls, String key,
			int value) {
		Intent intent = new Intent();
		if (key != null) {
			intent.putExtra(key, value);
		}
		intent.setClass(context, cls);
		context.startActivity(intent);
		intent = null;
	}

	/**
	 * 页面跳转
	 * 
	 * @param context
	 * @param cls
	 * @param key
	 * @param value
	 * @see [类、类#方法、类#成员]
	 */
	public static void startActivity(Context context, Class<?> cls, String key,
			String value) {
		Intent intent = new Intent();
		if (key != null) {
			intent.putExtra(key, value);
		}
		intent.setClass(context, cls);
		context.startActivity(intent);
		intent = null;
	}

	/**
	 * 页面跳转
	 * 
	 * @param context
	 * @param cls
	 * @param key
	 * @param value
	 * @see [类、类#方法、类#成员]
	 */
	public static void startActivity(Context context, Class<?> cls,
			Vector<String> keys, Vector<String> values) {
		Intent intent = new Intent();
		if (keys != null && values != null && keys.size() == values.size()) {
			int i = 0;
			int len = keys.size();
			for (; i < len; i++) {
				intent.putExtra(keys.get(i), values.get(i));
			}
		}
		intent.setClass(context, cls);
		context.startActivity(intent);
		intent = null;
	}
}
